﻿using System.Collections.Generic;
using Fabrication.Tests.TestClasses;
using NUnit.Framework;

namespace Fabrication.Tests
{
    [TestFixture]
    public class interfaces
    {
        [Test]
        public void should_set_interface_properties_to_null_if_no_rule_supplied()
        {
            var builtItem = new FabricationScope().Generate<SinglePropertyClass<IInterface>>();

            Assert.That(builtItem.Value, Is.Null);
        }

        [Test]
        public void should_set_interface_properties_if_rule_supplied()
        {
            var builtItem = new FabricationScope().Setup<SinglePropertyClass<IInterface>>()
                .For(x => x.Value).Use(new Implementation())
                .Generate();

            Assert.That(builtItem.Value, Is.Not.Null);
        }

        [Test]
        public void should_set_enumerable_properties_to_empty_list()
        {
            var builtItem = new FabricationScope().Generate<SinglePropertyClass<IEnumerable<string>>>();

            Assert.That(builtItem.Value, Is.Not.Null);
        }
    }
}
